﻿<cfsilent>
	<cfscript>

		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		propAdvice = getProperty("serviceFactory").getBean("studentPropertyAdvice");
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		stringAdvice = getProperty("serviceFactory").getBean("stringAdvice");
		
		studentId = event.getArg('STU');
		
		/* 学校信息 */
		sql = "SELECT sch_name 
				FROM t_school ";
		queryObj = new Query( datasource=application.dnsSlave ) ;
		rs_school = queryObj.execute( sql=sql ).getResult();
		
		/* 学生信息 */
		sql = "SELECT a.stu_name,a.stu_id,
					   a.stu_sex,a.stu_birthday,
					   t_idcard_type.idtype_name,a.stu_idcard,
					   t_nation.nation_name,a.stu_name_used,
					   a.sbj_direction 
				FROM t_student a 
					 INNER JOIN t_idcard_type ON t_idcard_type.idtype = a.idtype 
					 INNER JOIN t_nation ON t_nation.nation_code = a.nation_code 
				WHERE a.stu_id = :studentId ";
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="studentId", value=studentId, cfsqltype="cf_sql_varchar" );
		rs_student = queryObj.execute( sql=sql ).getResult();
		
		/* 学生学籍信息 */
		sql = "SELECT  b.student_prop,b.candidatesno,
					   t_foster_type.foster_type,b.date_join,
					   b.status_code,b.homeaddr,
					   b.zipcode,t_student_type.student_type 
				FROM t_student a 
					 INNER JOIN t_student_status b ON a.stu_id = b.stu_id 
					 INNER JOIN t_foster_type ON t_foster_type.f_id = b.f_id 
					 INNER JOIN t_student_type ON t_student_type.st_id = b.st_id 
				WHERE a.stu_id = :studentId ";
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="studentId", value=studentId, cfsqltype="cf_sql_varchar" );
		rs_profile= queryObj.execute( sql=sql ).getResult();
		
		/* 学生所在行政班 */
		sql = "SELECT a.grade,a.cls_found,
					   a.cls_name 
				FROM t_class a 
					 INNER JOIN t_student ON t_student.cls_id = a.cls_id 
				WHERE t_student.stu_id = :studentId ";
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="studentId", value=studentId, cfsqltype="cf_sql_varchar" );
		rs_class= queryObj.execute( sql=sql ).getResult();
		/* 班级归属专业 */
		sql = "SELECT a.sbj_id,t_institute.institute_name,
					   a.sbj_name,a.level_code,
					   a.schooling_length 
				FROM t_student 
					 INNER JOIN t_class ON t_class.cls_id = t_student.cls_id 
					 INNER JOIN t_subject a ON a.sbj_id = t_class.sbj_id 
					 INNER JOIN t_institute ON t_institute.institute_id = a.institute_id 
				WHERE t_student.stu_id = :studentId ";
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="studentId", value=studentId, cfsqltype="cf_sql_varchar" );
		rs_subject= queryObj.execute( sql=sql ).getResult();
		
		/* 学籍异动记录 */
		sql = "SELECT 
					  a.stuchg_id, t_stuchange_type.sct_name, 
					  a.stu_id, t_student.stu_name, 
					  a.op_description, a.change_date, 
					  t_student_status.student_prop
				FROM t_stuchange a 
					 INNER JOIN t_student ON t_student.stu_id = a.stu_id 
					 INNER JOIN t_student_status ON t_student.stu_id = t_student_status.stu_id  
					 INNER JOIN t_stuchange_type ON t_stuchange_type.sct_code = a.sct_code 
				WHERE 
					  t_student.stu_id = :studentId 
				ORDER BY a.stuchg_id DESC ";
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="studentId", value=studentId, cfsqltype="cf_sql_varchar" );
		rs_history= queryObj.execute( sql=sql ).getResult();
						
		event.setArg("pageTitle", "教学运行基础数据 - 学生学籍 - 个人学籍档案 - " & rs_student.stu_name);
		
		propAdvice.parseProperty( rs_profile.student_prop );
		
		targetArgs = structNew();
		structInsert(targetArgs, "SubID", rs_subject.sbj_id, true);
		structInsert(targetArgs, "Grade", rs_class.grade, true);
		
		passArgs = structNew();
		structInsert(passArgs, "STU", studentId);
		
		currentTab = event.getArg("TabID", "labBasic");
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('studentBySubject', targetArgs)#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">专业班级设置</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i>个人学籍档案 - <cfoutput>#rs_student.stu_name#</cfoutput>
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labBasic">class="active"</cfif> id="labBasic" tabTarget="Basic">学籍档案</span>
						<span <cfif currentTab eq "labChange">class="active"</cfif> id="labChange" tabTarget="Change">学籍变更记录</span>
						<span <cfif currentTab eq "labDetail">class="active"</cfif> id="labDetail" tabTarget="Detail">学生诚信档案</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="Basic" class="tabContent">
					<div class="noticeBlock">
						<h3>教育部学籍管理注册信息数据</h3>
						<hr/>
					</div>
					<table class="UItable withBorder">
						<tr>
							<td>考生号</td>
							<td colspan="3"><span class="number"><cfoutput>#rs_profile.candidatesno#</cfoutput></span></td>
							<td>学号</td>
							<td><span class="number"><cfoutput>#rs_student.stu_id#</cfoutput></span></td>
							<td style="padding:0;" width="135" height="180" valign="middle" align="center" rowspan="6"><img width="135" height="180" align="middle" src="<cfoutput>#getContextRoot()#</cfoutput>/acadmicManager/student/profile/<cfoutput>#rs_student.stu_id#</cfoutput>.jpg" /></td>
						</tr>
						<tr>
							<td>姓名</td>
							<td><cfoutput>#rs_student.stu_name#</cfoutput></td>
							<td>性别</td>
							<td><cfif rs_student.stu_sex eq "1">男<cfelse>女</cfif></td>
							<td>出生日期</td>
							<td><span class="number"><cfoutput>#datetimeAdvice.formatDateString(rs_student.stu_birthday)#</cfoutput></span></td>
						</tr>
						<tr>
							<td><cfoutput>#rs_student.idtype_name#</cfoutput></td>
							<td colspan="3"><span class="number"><cfoutput>#rs_student.stu_idcard#</cfoutput></span></td>
							<td>民族</td>
							<td><cfoutput>#rs_student.nation_name#</cfoutput></td>
						</tr>
						<tr>
							<td>院校名称</td>
							<td colspan="5"><cfoutput>#rs_school.sch_name#</cfoutput></td>
						</tr>
						<tr>
							<td>分院(系所)</td>
							<td colspan="5"><cfoutput>#rs_subject.institute_name#</cfoutput></td>
						</tr>
						<tr>
							<td>专业名称</td>
							<td colspan="5"><cfoutput>#rs_subject.sbj_name#</cfoutput></td>
						</tr>
						<tr>
							<td>层次</td>
							<td colspan="3"><cfoutput>#dictAdvice.getStudentLevel(rs_subject.level_code)#</cfoutput></td>
							<td>学制</td>
							<td colspan="2"><cfoutput>#rs_subject.schooling_length#</cfoutput>年</td>
						</tr>
						<tr>
							<td>培养方式</td>
							<td colspan="3"><cfoutput>#rs_profile.foster_type#</cfoutput></td>
							<td>学生类别</td>
							<td colspan="2"><cfoutput>#rs_profile.student_type#</cfoutput></td>
						</tr>
						<tr>
							<td>入学日期</td>
							<td colspan="3"><span class="number"><cfif rs_profile.date_join eq ""><cfoutput>#datetimeAdvice.formatDateString(rs_class.cls_found & "01")#</cfoutput><cfelse><cfoutput>#datetimeAdvice.formatDateString(rs_profile.date_join)#</cfoutput></cfif></span></td>
							<td>学籍状态</td>
							<td colspan="2"><cfoutput>#dictAdvice.getStudentCurrentStatus(rs_profile.status_code)#</cfoutput></td>
						</tr>
					</table>
					<div class="noticeBlock">
						<h3>校内学籍信息数据</h3>
						<hr/>
					</div>
					<table class="UItable withBorder">
						<tr>
							<td>学号</td>
							<td><span class="number"><cfoutput>#rs_student.stu_id#</cfoutput></span></td>
							<td>姓名</td>
							<td><cfoutput>#rs_student.stu_name#</cfoutput></td>
							<td>曾用名</td>
							<td><cfif rs_student.stu_name_used neq "">
									<cfoutput>#rs_student.stu_name_used#</cfoutput>
									<cfelse>
									-
								</cfif></td>
						</tr>
						<tr>
							<td>行政班</td>
							<td><cfoutput>#rs_class.cls_name#</cfoutput></td>
							<td>年级</td>
							<td><span class="number"><cfoutput>#rs_class.grade#</cfoutput></span></td>
							<td>预期毕业年份</td>
							<td><span class="number"><cfoutput>#int((rs_class.grade + rs_subject.schooling_length))#</cfoutput></span></td>
						</tr>
						<tr>
							<td>是否在校</td>
							<td><cfif propAdvice.getInSchool()>是<cfelse><span class="alert">否</span></cfif></td>
							<td>专业</td>
							<td><cfoutput>#rs_subject.sbj_name#</cfoutput></td>
							<td>专业方向</td>
							<td><cfif rs_student.sbj_direction eq "0">
									无
									<cfelse>
                                    <cfset sql = "SELECT a.sbj_name  
													FROM  t_subject a  
													WHERE a.sbj_id = :dirId "/>
                                    <cfset queryObj = new Query( datasource=application.dnsSlave )/>
                                    <cfset queryObj.addParam( name="dirId", value= rs_subject.sbj_id & rs_student.sbj_direction, cfsqltype="cf_sql_varchar" )/>
                                    <cfset rs_direction= queryObj.execute( sql=sql ).getResult()/>
									<cfif rs_direction.recordCount>
										<cfoutput>#rs_direction.sbj_name#</cfoutput>
									</cfif>
								</cfif></td>
						</tr>
						<tr>
							<td>家庭通讯地址</td>
							<td colspan="5"><cfoutput>#stringAdvice.HTMLEncode( rs_profile.homeaddr )#</cfoutput> <cfif len( rs_profile.zipcode )><br/>邮编: <cfoutput>#stringAdvice.HTMLEncode( rs_profile.zipcode )#</cfoutput></cfif></td>
						</tr>
					</table>
				</div>
				
				<div id="Change" class="tabContent">
				
					<div class="noticeBlock">
						<h3>学生学籍异动记录</h3>
						<hr/>
					</div>
					
					<cfif rs_history.recordCount>
							<cfset row = 0 />
							<table class="UIEditable">
								<thead>
									<tr>
										<td width="18"></td>
										<td width="90">学号</td>
										<td>姓名</td>
										<td width="60">异动类别</td>
										<td>异动内容</td>
										<td>处理时间</td>
									</tr>
								</thead>
								<tbody>
                                    <cfloop query="rs_history" >
									
										<cfset row++ />
										<cfset structInsert(passArgs, "DOCID", rs_history.stuchg_id, true) />
										<cfset structInsert(passArgs, "STU", rs_history.sct_name, true) />
										
										<cfset propAdvice.parseProperty(rs_history.student_prop) />
										
										<tr class="editRows <cfif not propAdvice.getInSchool()>alertRow</cfif>">
											<td class="index"><cfoutput>#row#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#rs_history.stu_id#</cfoutput></span></td>
											<td><cfoutput>#rs_history.stu_name#</cfoutput></td>
											<td><cfoutput>#rs_history.sct_name#</cfoutput></td>
											<td><cfoutput>#rs_history.op_description#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#datetimeAdvice.formatDatetimeString(rs_history.change_date, 'YYYY/MM/DD')#</cfoutput></span></td>
										</tr>
									
									</cfloop>
								</tbody>
							</table>
						<cfelse>
							<div class="systemNotice">
								<p>没有学籍异动历史记录</p>
							</div>
					</cfif>
				</div>
				
			</div>
		</li>
	</ul>
</div>